import React, { Component } from 'react';
import { Modal, Transfer } from 'antd';

export default class BillSettlement extends Component {   

    filterOption = (inputValue, option) => option.title.indexOf(inputValue) > -1

    handleChange = (targetKeys) => {
        this.props.patchBillInfo(targetKeys);
    }

    render() {
        const { visible, onCancel, onOk, okText, title } = this.props;
        return (
            <Modal
                visible={visible}
                title={title}
                okText={okText}
                cancelText='取消'
                onCancel={onCancel}
                onOk={onOk}
            >
                <Transfer
                    dataSource={this.props.orderDayArr}
                    titles={['待结算', '已结算']}
                    showSearch
                    locale={{ itemUnit: '天', itemsUnit: '天', notFoundContent: '列表为空', searchPlaceholder: '请输入搜索内容' }}
                    filterOption={this.filterOption}
                    targetKeys={this.props.targetKeys}
                    onChange={this.handleChange}
                    render={item => item.title}
                />
            </Modal>
        );
    }
}